package com.sbpm.crmbpm.client.deprecforms.controls;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.ListBox;
import com.sbpm.crmbpm.client.services.UserService;
import com.sbpm.crmbpm.client.services.UserServiceAsync;

import java.util.List;

/**
 * Created by TT on 09.11.2014.
 */
public class UsersComboBox extends ListBox
{
    private final UserServiceAsync userService = GWT.create( UserService.class );

    public UsersComboBox()
    {
        userService.getUsers( new AsyncCallback<List<String>>() {
            @Override
            public void onFailure(Throwable throwable) {

            }

            @Override
            public void onSuccess(List<String> strings)
            {
                for( String user : strings )
                {
                    addItem( user );
                }

            }
        } );
    }
}
